#pragma once

#include <D3D11.h>
#include <DXGI.h>
#include <Windows.h>
#include <xnamath.h>

namespace TestDX
{

class D3D11
{
public:
	D3D11();
	~D3D11();

	bool Init(
		HWND hwnd,
		int width,
		int height,
		float screenDepth,
		float screenNear);

	void Shutdown();

	//< Clears buffers
	void BeginScene();

	//< Present the scene
	void EndScene();

	// Useful getters, inlined
	ID3D11Device * GetDevice() { return _pDevice; }
	ID3D11DeviceContext * GetDeviceContext() { return _pDeviceContext; }
	const XMFLOAT4X4 * GetProjectionMatrix() { return &_projectionMatrix; }
	const XMFLOAT4X4 * GetWorldMatrix() { return &_worldMatrix; }

	// @ TODO: void GetVideoCardInfo(char *, int &);

private:
	// Copy and assign are forbidden
	D3D11(const D3D11 &);
	D3D11 & operator=(const D3D11 &);

	// Attribs
	IDXGISwapChain * _pSwapChain;
	ID3D11Device * _pDevice;
	ID3D11DeviceContext * _pDeviceContext;
	ID3D11RenderTargetView * _pRenderTargetView;
	ID3D11Texture2D * _pDepthStencilBuffer;
	ID3D11DepthStencilView * _pDepthStencilView;
	ID3D11RasterizerState * _pRasterState;

	// Matrix time!
	XMFLOAT4X4 _projectionMatrix;
	XMFLOAT4X4 _orthoMatrix;
	XMFLOAT4X4 _worldMatrix;
};

}